//
//  DHUserInfoTableViewCell.m
//  DHKuaiYi
//
//  Created by xiaohuihui on 2016/11/13.
//  Copyright © 2016年 30-陈辉华. All rights reserved.
//

#import "DHUserInfoTableViewCell.h"
#import "Masonry.h"

@interface DHUserInfoTableViewCell ()

@property (nonatomic, weak) UILabel *userInfoTitle;
/*---------- 用户信息内容 ----------*/
@property (nonatomic, weak) UILabel *userInfoContent;

@end

@implementation DHUserInfoTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setUserInfoModel:(DHUserInfoModel *)userInfoModel {
    _userInfoModel = userInfoModel;
    _userInfoTitle.text = userInfoModel.title;
    _userInfoContent.text = userInfoModel.userInfoContent;
}

- (void)setupUI {
    //1.title
    UILabel *userInfoTitle = [[UILabel alloc] init];
    [self.contentView addSubview:userInfoTitle];
    userInfoTitle.font = [UIFont systemFontOfSize:16];
    userInfoTitle.textColor = [UIColor colorWithRed:0.29 green:0.29 blue:0.29 alpha:1.00];
    
    //userInfoContent
    UILabel *userInfoContent = [[UILabel alloc] init];
    [self.contentView addSubview:userInfoContent];
    userInfoContent.font = [UIFont systemFontOfSize:14];
    userInfoContent.textColor = [UIColor colorWithRed:0.29 green:0.29 blue:0.29 alpha:1.00];
    
    //自动布局
    [userInfoTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView);
        make.left.mas_equalTo(self.contentView).offset(10);
    }];
    
    [userInfoContent mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView);
        make.right.mas_equalTo(self.contentView).offset(-5);
    }];
    
    //记录属性
    self.userInfoTitle = userInfoTitle;
    self.userInfoContent = userInfoContent;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
